﻿/*
 * Console.h
 */
#ifndef __GDK_CONSOLE_H__
#define __GDK_CONSOLE_H__

#include <gdk/core/Types.h>


namespace gdk
{

	class ConsoleScreenBufferInfo
	{
	public:
		int			width, height;
		int			x, y;
		uint16_t	textAttributes;
	};

	class Console
	{
	public:
#ifdef _WIN32
		enum TextAttributes {
			TEXT_FOREGROUND_BLUE		= FOREGROUND_BLUE		,// text color contains blue.
			TEXT_FOREGROUND_GREEN		= FOREGROUND_GREEN		,// text color contains green.
			TEXT_FOREGROUND_RED			= FOREGROUND_RED		,// text color contains red.
			TEXT_FOREGROUND_INTENSITY	= FOREGROUND_INTENSITY	,// text color is intensified.
			TEXT_BACKGROUND_BLUE		= BACKGROUND_BLUE		,// background color contains blue.
			TEXT_BACKGROUND_GREEN		= BACKGROUND_GREEN		,// background color contains green.
			TEXT_BACKGROUND_RED			= BACKGROUND_RED		,// background color contains red.
			TEXT_BACKGROUND_INTENSITY	= BACKGROUND_INTENSITY	,// background color is intensified.
		};
#else
		enum TextAttributes {
			TEXT_FOREGROUND_BLUE		= 1		,// text color contains blue.
			TEXT_FOREGROUND_GREEN		= 2		,// text color contains green.
			TEXT_FOREGROUND_RED			= 3		,// text color contains red.
			TEXT_FOREGROUND_INTENSITY	= 4		,// text color is intensified.
			TEXT_BACKGROUND_BLUE		= 5		,// background color contains blue.
			TEXT_BACKGROUND_GREEN		= 6		,// background color contains green.
			TEXT_BACKGROUND_RED			= 7		,// background color contains red.
			TEXT_BACKGROUND_INTENSITY	= 8		,// background color is intensified.
		};
#endif

		GDK_CORE_EXPORT static bool alloc(void);
		GDK_CORE_EXPORT static void free(void);
		GDK_CORE_EXPORT static bool setTextAttribute(uint32_t attributes);
		GDK_CORE_EXPORT static void output(const Char *fmt, ...) __PRINTF_FORMAT(1, 2);
		GDK_CORE_EXPORT static bool getScreenBufferInfo(ConsoleScreenBufferInfo &consoleScreenBufferInfo);
		GDK_CORE_EXPORT static bool setCursorPosition(int x, int y);
	};



}//namespace gdk


#endif //__GDK_CONSOLE_H__
